package com.hust.bridgecheck.serviceImpl.Settings;

import com.hust.bridgecheck.entity.WarningSetting;
import com.hust.bridgecheck.repository.WarningSettingRepository;
import com.hust.bridgecheck.service.Settings.WarningSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WarningSServiceImpl implements WarningSService {

    @Autowired
    WarningSettingRepository warningSettingRepository;

    @Override
    public WarningSetting addWarningSetting(WarningSetting warningSetting) {
        return warningSettingRepository.save(warningSetting);
    }

    @Override
    public void deleteWarningSetting(Integer WarningSettingID) {
        warningSettingRepository.deleteById(WarningSettingID);
    }

    @Override
    public WarningSetting updateWarning(WarningSetting warningSetting) {
        return warningSettingRepository.save(warningSetting);
    }

    @Override
    public List<WarningSetting> getAllWarningSetting() {
        return warningSettingRepository.findAll();
    }
}
